<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace Behavior;

/**
 * 行为扩展：代理检测
 */
class AgentCheckBehavior {
	public function run(&$params) {
		// 代理访问检测
		$limitProxyVisit = C ( 'LIMIT_PROXY_VISIT', null, true );
		if ($limitProxyVisit && ($_SERVER ['HTTP_X_FORWARDED_FOR'] || $_SERVER ['HTTP_VIA'] || $_SERVER ['HTTP_PROXY_CONNECTION'] || $_SERVER ['HTTP_USER_AGENT_VIA'])) {
			// 禁止代理访问
			exit ( 'Access Denied' );
		}
	}
}
